const gulp = require("gulp");
const ts = require("gulp-typescript");
const rollup = require("rollup");
const typescript = require('rollup-plugin-typescript2');
const compress = require('rollup-plugin-uglify')
console.log('uglify:',compress)

gulp.task('default', function () {
    return roComple(true);
})

gulp.task('debug', function () {
    return roComple(false);
})


function roComple(comp) {
    return rollup.rollup({
        input: './Creator/Global.ts',
        treeshake: true,//建议忽略
        plugins: [
            typescript({
                check: false,
                clean:true,
                tsconfigOverride: { compilerOptions: { removeComments: true } }
            }),
            comp?compress.uglify():null
        ]
    }).then(bundle => {
        return bundle.write({
            file: './sdk.min.js',
            format: 'iife',
            name: '',
            sourcemap: false
        });
    });
}